DiagonalSp

class DiagonalSp(val initialBaseValue: Number, val defaultFontScale: Boolean = true, val sortedCustomEntries: List<CustomSpEntry> = emptyList(), val ignoreMultiWindows: Boolean = false, val applyAspectRatio: Boolean = false, val customSensitivityK: Float? = null)

EN A class that allows defining custom Sp text dimensions based on screen qualifiers (UiModeType, Width, Height, Smallest Width).

The value is resolved using a Context and uses the base value or a custom value, applying dynamic scaling.

PT Classe que permite definir dimensões de texto Sp customizadas baseadas em qualificadores de tela (UiModeType, Largura, Altura, Smallest Width).

Constructors

Link copied to clipboard
private constructor(initialBaseValue: Number, defaultFontScale: Boolean = true, sortedCustomEntries: List<CustomSpEntry> = emptyList(), ignoreMultiWindows: Boolean = false, applyAspectRatio: Boolean = false, customSensitivityK: Float? = null)
constructor(initialBaseValue: Number)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun aspectRatio(enable: Boolean = true, sensitivityK: Float? = null): DiagonalSp

EN Allow applying aspect ratio based constraint scaling. PT Permite aplicar o redimensionamento baseado na proporção da tela.

Link copied to clipboard
fun dghem(context: Context): Float
Link copied to clipboard
fun dghsp(context: Context): Float
Link copied to clipboard
fun dgsem(context: Context): Float

EN Resolve final value in pixels (WITHOUT font scale).

Link copied to clipboard

EN Resolves dgsem, dghem, and dgwem in one pass (fixed Sp / no font-scale path). PT Resolve dgsem, dghem e dgwem numa só passagem (Sp fixo / sem escala de fonte).

Link copied to clipboard
fun dgssp(context: Context): Float

EN Resolve final value in pixels (WITH font scale).

Link copied to clipboard

EN Resolves dgssp, dghsp, and dgwsp in one pass (single UiModeType.fromConfiguration read). PT Resolve dgssp, dghsp e dgwsp numa só passagem.

Link copied to clipboard
fun dgwem(context: Context): Float
Link copied to clipboard
fun dgwsp(context: Context): Float
Link copied to clipboard

EN Allow ignoring the constraint scaling based on multi-window resizing properties. PT Permite ignorar o dimensionamento para os layouts de múltiplas janelas (divisão de tela).

Link copied to clipboard

EN Adds a new entry and re-sorts the list by priority, then by qualifier value (descending).

Link copied to clipboard
private fun resolvePx(context: Context, qualifier: DpQualifier, fontScaleOverride: Boolean? = null): Float

EN Resolves qualifier to px using the first matching CustomSpEntry, optionally overriding font scale. PT Resolve qualifier em px usando a primeira CustomSpEntry correspondente, com override opcional da escala de fonte.

Link copied to clipboard
private fun resolvePxInternal(context: Context, qualifier: DpQualifier, configuration: Configuration, currentUiModeType: UiModeType, fontScaleOverride: Boolean?): Float

EN Shared implementation for resolvePx, dgsspDghspDgwspPx, and dgsemDghemDgwemPx. PT Implementação compartilhada para resolvePx, dgsspDghspDgwspPx e dgsemDghemDgwemPx.

Link copied to clipboard
fun screen(orientation: Orientation = Orientation.DEFAULT, customValue: Number, finalQualifierResolver: DpQualifier? = null, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DiagonalSp

EN Priority 4: orientation only. PT Prioridade 4: apenas orientação.

fun screen(type: UiModeType, customValue: Number, finalQualifierResolver: DpQualifier? = null, orientation: Orientation = Orientation.DEFAULT, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DiagonalSp

EN Priority 2: UiModeType only (e.g. TELEVISION, WATCH). PT Prioridade 2: apenas UiModeType (ex.: TELEVISION, WATCH).

fun screen(type: DpQualifier, value: Int, customValue: Number, finalQualifierResolver: DpQualifier? = null, orientation: Orientation = Orientation.DEFAULT, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DiagonalSp

EN Priority 3: Dp qualifier (sw, h, w) without UiModeType restriction. PT Prioridade 3: qualificador Dp (sw, h, w) sem restrição de UiModeType.

fun screen(uiModeType: UiModeType, qualifierType: DpQualifier, qualifierValue: Number, customValue: Number, finalQualifierResolver: DpQualifier? = null, orientation: Orientation = Orientation.DEFAULT, inverter: Inverter = Inverter.DEFAULT, fontScale: Boolean = defaultFontScale): DiagonalSp

EN Priority 1: Most specific qualifier — combines UiModeType and Dp qualifier (sw, h, w). PT Prioridade 1: qualificador mais específico — combina UiModeType e qualificador Dp (sw, h, w).